//
//  OneViewController.m
//  Number
//
//  Created by xjq on 16/2/22.
//  Copyright © 2016年 xjq. All rights reserved.
//

#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThridViewController.h"
#import "zeroViewController.h"

@interface OneViewController ()
@property (nonatomic,strong)zeroViewController *oneBtn;

@property(nonatomic,strong)TwoViewController *twoBtn;
@property(nonatomic,strong)ThridViewController *thridBtn;




@end

@implementation OneViewController
-(zeroViewController *)oneBtn
{
    if(_oneBtn == nil)
    {
        _oneBtn = [[zeroViewController alloc] init];
    }
    return _oneBtn;
}

-(TwoViewController *)twoBtn
{
    if (_twoBtn == nil) {
        _twoBtn = [[TwoViewController alloc]init];
    }
    return _twoBtn;
}

-(ThridViewController *)thridBtn
{
    if (_thridBtn == nil) {
        _thridBtn = [[ThridViewController alloc]init];
    }
    return _thridBtn;
}





- (IBAction)firstView:(id)sender
{
    //插入动画效果（UIView简单切换动画）
    [UIView beginAnimations:@"ViewFlip" context:nil];
    //动画的时间
    [UIView setAnimationDuration:1.25];
    //运动方式
    [UIView setAnimationCurve:UIAccessibilityAnnouncementNotification];
    
    [self.view insertSubview:self.oneBtn.view atIndex:0];
    
    [self.twoBtn.view removeFromSuperview];
    [self.thridBtn.view removeFromSuperview];
    
    //运动的样式
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp  forView:self.view cache:YES];

    //动画开始播放
    [UIView commitAnimations];
}

- (IBAction)seconedview:(id)sender
{
    //插入动画效果（UIView简单切换动画）
    [UIView beginAnimations:@"ViewFlip" context:nil];
    //动画的时间
    [UIView setAnimationDuration:1.25];
    //运动方式
    [UIView setAnimationCurve:UIAccessibilityAnnouncementNotification];
    
    [self.view insertSubview:self.twoBtn.view atIndex:0];
    [self.oneBtn.view removeFromSuperview];
    [self.thridBtn.view removeFromSuperview];
    
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp  forView:self.view cache:YES];
   
    [UIView commitAnimations];
}



- (IBAction)thirdView:(id)sender
{
    //插入动画效果（UIView简单切换动画）
    [UIView beginAnimations:@"ViewFlip" context:nil];
    //动画的时间
    [UIView setAnimationDuration:1.25];
    //运动方式
    [UIView setAnimationCurve:UIAccessibilityAnnouncementNotification];
    
    
    [self.view insertSubview:self.thridBtn.view atIndex:0];
    [self.oneBtn.view removeFromSuperview];
    [self.twoBtn.view removeFromSuperview];
    
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    [UIView commitAnimations];
    
}













- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
